package com.ttuproject.ttu.controller;

import com.ttuproject.ttu.advice.ResponseEnvelope;
import com.ttuproject.ttu.dao.InstallationAccount;
import com.ttuproject.ttu.exception.Advice;
import com.ttuproject.ttu.service.UpdateStationService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName UpdateStationController
 * @Description TODO
 * @Author cw
 * @Date 2021/12/9 11:33
 */
@RestController
@Api(value = "查看想要操作的总表数据", tags = "查看想要操作的总表数据", description = "查看想要操作的总表数据")
public class ModifyStationController {

    @Autowired
    UpdateStationService updateStationService;

    /**
     * @explain: 查看想要操作的总表数据
     * @author: cw
     * @date: 2021/12/9
     */
    //@RequestMapping("/query/station")
    @GetMapping("/query/station")
    public ResponseEntity<ResponseEnvelope<InstallationAccount>> queryStationList(@RequestParam("linkage1") String linkage1, @RequestParam("linkage2") String linkage2, @RequestParam("linkage3") String linkage3) {
        return ResponseEntity.ok(new ResponseEnvelope<>(Advice.QUERY_STATION_SUCCESS, updateStationService.queryStation(linkage1, linkage2, linkage3)));
    }

    //@RequestMapping("/update/stationlist")
    @GetMapping("/update/stationlist")
    public ResponseEntity<ResponseEnvelope<Boolean>> updateStationList(@RequestBody(required = false) InstallationAccount installationAccount,String userName,String passWord) {
        return ResponseEntity.ok(new ResponseEnvelope<>(Advice.UPDATE_STATIONLIST_SUCCESS, updateStationService.updateStationList(installationAccount,userName,passWord)));
    }

    //@RequestMapping("/insert/station")
    @GetMapping("/insert/station")
    public ResponseEntity<ResponseEnvelope<Boolean>> insertStationList(@RequestBody(required = false) InstallationAccount installationAccount,String userName,String passWord) {
        return ResponseEntity.ok(new ResponseEnvelope<>(Advice.INSERT_STATIONLIST_SUCCESS, updateStationService.insertStationList(installationAccount,userName,passWord)));
    }



}
